<?php
// +----------------------------------------------------------------------
// | WoShiMaiJia Projcet
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://woshimaijia.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: xinqiyang <517577550@qq.com>
// +----------------------------------------------------------------------
/**
 * 商品Model
 * @author xinqiyang
 * @date   2010-7-7
 *
 */
class GoodsModel extends MetaModel
{


	protected $_validate  = array(
	array ('fromurl','url','来源网址不能为空或者没填对,应该加http://',1,'',1),
	array ('title','require','名称不能为空',1,'',1),
	array ('tags','require','关键字不能为空',1,'',1),
	array ('desc','require','商品描述不能为空',1,'',1),
	array ('showtype','require','显示类型不能为空',1,'',1),
	array ('price','number','价格不能为空或填写不正确',1,'',1),
	);


	protected $_auto = array(
	array ('status','1'),
	array ('createtime','time',1,'function'),
	array ('user_id','userID',1,'function'),
		

	);
	
	function getGoods($arr)
	{
		return  $this->query("select sz_goods.id as gid,sz_goods.title,sz_goods.imageids,sz_goods.showtype,sz_goods.user_id,sz_goods.tags,sz_goods.likenum,sz_goods.brand_id,sz_goods.desc,sz_user.cnname,sz_goods.user_id as uid,sz_goods.wantnum,sz_goods.ownernum,sz_goods.brand_id,sz_goods.locationid,sz_goods.fromurl,sz_image.id,sz_image.url,sz_image.model,sz_image.filename from sz_goods,sz_image,sz_user where sz_goods.image_id=sz_image.id and sz_goods.user_id = sz_user.id and sz_goods.id in ".strin($arr));
		
	}
	
	function newgetGoods($arr)
	{
		return  $this->query("select sz_goods.id as gid,sz_goods.title,sz_goods.showtype,sz_goods.user_id,sz_goods.tags,sz_goods.likenum,sz_goods.brand_id,sz_goods.desc,sz_user.cnname,sz_goods.user_id as uid,sz_goods.wantnum,sz_goods.ownernum,sz_goods.brand_id,sz_goods.locationid,sz_goods.fromurl,sz_image.id,sz_image.url,sz_image.model,sz_image.filename from sz_goods,sz_image,sz_user where sz_goods.image_id=sz_image.id and sz_goods.user_id = sz_user.id and sz_goods.id in ".$arr.' order by rand()');
		
	}
}
?>